package com.thirteen.app.service.impl;

import com.thirteen.app.dao.UserDao;
import com.thirteen.app.dto.UserCollegeDto;
import com.thirteen.app.entity.User;
import com.thirteen.app.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 *
 */
@Service

public class UserServiceImpl implements UserService {
    @Resource
    private UserDao userDao;

    @Override
    public List<UserCollegeDto> getuserPageList(Integer pageIndex, Integer pageSize, String role, String userName) {
        return userDao.getuserPageList((pageIndex - 1) * pageSize, pageSize, role, userName);
    }

    @Override
    public List<User> getuserList() {
        return userDao.getuserList();
    }

    @Override
    public int userCount(String role, String userName) {
        return userDao.userCount(role, userName);
    }

    //改变用户状态
    @Override
    public int UpdateUser(User user) {
        return userDao.UpdateUser(user);
    }

    @Override
    public int deleteById(Integer userid) {
        return userDao.deleteById(userid);
    }

    @Override
    public UserCollegeDto queryById(Integer userid) {
        return userDao.queryById(userid);
    }

    @Override
    public User login(User user) {
        return userDao.login(user.getUserName(), user.getPassWord());
    }

    @Override
    public int updateUserAddress(User user) {
        return userDao.UpdateUser(user);
    }

   /* @Override
    public List<Logs> getUserEventPageList(Integer pageIndex, Integer pageSize, Integer userid) {
        return userDao.getUserEventPageList((pageIndex-1)*pageSize,pageSize,userid);
    }*/

   @Override
    public int UpdateUserInfo(User user){
         return userDao.UpdateUserInfo(user);
   }

    @Override
   public int createUser(User user){
       return userDao.createUser(user);
    }
}
